package org.yn.base.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.yn.auth.domain.Role;
import org.yn.auth.mapper.RoleMapper;
import org.yn.base.mapper.IBaseMapper;

import java.util.List;
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class BaseServiceImpl<T> {

    @Autowired
    IBaseMapper roleMapper;

    @Transactional
    public void update(T role) {
        roleMapper.update(role);
    }

    @Transactional
    public void insert(T role) {
        roleMapper.insert(role);
    }


    public List<T> selectAll() {
        return roleMapper.selectAll();
    }


    public T selectById(Long id) {
        return (T) roleMapper.selectById(id);
    }

    @Transactional
    public void delete(Long id) {
        roleMapper.delete(id);
    }

    @Transactional
    public void batchDelete(List<Long> ids) {
        roleMapper.batchDelete(ids);
    }



}
